#define _CRT_SECURE_NO_WARNINGS

//删除有序数组中的重复项

class Solution {
public:
    int removeDuplicates(vector<int>& nums) {
        int n = nums.size();
        if(n <= 2)
            return n;
        int fast = 2;
        int slow = 2;
        while(fast<n)
        {
            if(nums[slow-2]!=nums[fast])
            {
                nums[slow] = nums[fast];
                ++slow;
            }
            ++fast;
        }
        return slow;
    }
};

